package com.tienon.message.thread;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import org.springframework.stereotype.Component;

import com.tienon.message.mq.SendAppMsgMQRunnable;

@Component
public class MQSendAppMsgTasks {

	private static ScheduledExecutorService pool = null;

	static {
		pool = Executors.newScheduledThreadPool(50);
	}

	public  void run() {
		for (int i = 0; i < 50; i++) {
			pool.scheduleAtFixedRate(new SendAppMsgMQRunnable(), 1,1,
					TimeUnit.MILLISECONDS);
			
		}
		
	}
	
	public  void shutdown(){
		
		pool.shutdown();
		
	}

}
